import Vue from 'vue'
import Router from 'vue-router'

const Peronal = resolve => {
  import('@/view/personal').then(module => {
    resolve(module)
  })
}
const Certificate = resolve => {
  import('@/view/personal/certificate').then(module => {
    resolve(module)
  })
}
const Card = resolve => {
  import('@/view/personal/card').then(module => {
    resolve(module)
  })
}
const Reservation = resolve => {
  import('@/view/personal/reservation').then(module => {
    resolve(module)
  })
}
const Ticket = resolve => {
  import('@/view/personal/ticket').then(module => {
    resolve(module)
  })
}
const Redenvelope = resolve => {
  import('@/view/personal/redenvelope').then(module => {
    resolve(module)
  })
}
const Order = resolve => {
  import('@/view/personal/order').then(module => {
    resolve(module)
  })
}

const Home = resolve => {
  import('@/view/home').then(module => {
    resolve(module)
  })
}

const Activity = resolve => {
  import('@/view/activity').then(module => {
    resolve(module)
  })
}

const ActiveDetail = resolve => {
  import('@/view/activity/active-detail').then(module => {
    resolve(module)
  })
}
const ActiveSignup = resolve => {
  import('@/view/activity/active-signup').then(module => {
    resolve(module)
  })
}
const Login = resolve => {
  import('@/view/login').then(module => {
    resolve(module)
  })
}
const ActivePay = resolve => {
  import('@/view/activity/active-pay').then(module => {
    resolve(module)
  })
}
const ActivePin = resolve => {
  import('@/view/activity/active-pin').then(module => {
    resolve(module)
  })
}
const Scene = resolve => {
  import('@/view/activity/active-scene').then(module => {
    resolve(module)
  })
}
const myScene = resolve => {
  import('@/view/activity/active-scene-my').then(module => {
    resolve(module)
  })
}
const Agreement = resolve => {
  import('@/view/activity/active-agreement').then(module => {
    resolve(module)
  })
}
const Coupon = resolve => {
  import('@/view/coupon').then(module => {
    resolve(module)
  })
}
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/home'
    }, {
      path: '/home',
      component: Home
    }, {
      path: '/',
      redirect: '/login'
    }, {
      path: '/login',
      component: Login
    }, {
      path: '/personal',
      component: Peronal,
      children: [
        {
          path: '/personal/card',
          component: Card
        }, {
          path: '/personal/certificate',
          component: Certificate
        }, {
          path: '/personal/reservation',
          component: Reservation
        }, {
          path: '/personal/ticket',
          component: Ticket
        }, {
          path: '/personal/redenvelope:id',
          component: Redenvelope
        }, {
          path: '/personal/order',
          component: Order
        }
      ]
    }, {
      path: '/activity:actype',
      component: Activity,
      children: [
        {
          path: '/activity/detail:id::applyId',
          component: ActiveDetail
        }, {
          path: '/activity/signup:id',
          component: ActiveSignup
        }, {
          path: '/activity/pay:id',
          component: ActivePay
        }, {
          path: '/activity/pin:id',
          component: ActivePin
        }, {
          path: '/activity/scene:applyId',
          component: Scene
        }, {
          path: '/activity/myScene:applyId',
          component: myScene
        }, {
          path: '/activity/agreement',
          component: Agreement
        }
      ]
    }, {
      path: '/coupon',
      component: Coupon
    }

  ]
})
